import os
import pickle

import dlib


def load_predictor():
    checkpoint = '/root/autodl-tmp/checkpoints/shape_predictor_68_face_landmarks_GTX.dat'
    predictor = dlib.shape_predictor(checkpoint)
    mouth_detector = dlib.get_frontal_face_detector()
    return predictor, mouth_detector 

    # Serialize the variables
    # with open(os.path.join("checkpoints", "predictor.pkl"), "wb") as f:
    #     pickle.dump(predictor, f)

    # with open(os.path.join("checkpoints", "mouth_detector.pkl"), "wb") as f:
    #     pickle.dump(mouth_detector, f)

load_predictor()


